<?php
namespace Suo\Controller;
use Common\Controller\ApiController;
class CookBookcontroller extends ApiController {
	
//	获取菜谱列表
	public function getCookList (){
		$conds = array();
		$title = $_REQUEST['dish_name'];
		if($title){
			$conds['dish_name'] = $title;
		}
		
		$page = $_REQUEST['p'] ? $_REQUEST['p'] : 1;
		$pageSize = $_REQUEST['pagesize'] ? $_REQUEST['pagesize'] : 10;
		$cooklist = D('CookBook')->getCookList($conds,$page,$pageSize);
		
		if($cooklist){
			$this->ApiShow('菜单列表',200,$cooklist);
		}
		$this->ApiShow('没有数据',120);
		
	}
	
	public function getcookbyid(){
		$id = intval($_REQUEST['id']);
		if($id){
			$data = D('CookBook')->getCookBookById($id);
			if($data){
				$this->ApiShow('菜单详情',200,$data);
			}
			$this->ApiShow("没有找到数据",403);
		}
		$this->ApiShow("id不存在或不合法",110);
	}
}
